package org.red.checkSystem.controller.check;

import com.alibaba.fastjson2.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.red.checkSystem.service.check.checkShowService;

import java.util.Map;

@RestController
@RequestMapping("/check")
public class checkShowController {
    @Autowired
    checkShowService checkShowService;
    @PostMapping("/getArticle/")
    public String getArticle(@RequestParam MultiValueMap<String,String> map){
        return checkShowService.getArticle(Integer.parseInt(map.getFirst("id")));
    }

    @PostMapping("/showAllArticleByState/")
    public JSONObject checkShowService(@RequestParam MultiValueMap<String,String> map){
        return checkShowService.showAllArticleByState(map.getFirst("state"),Integer.parseInt(map.getFirst("page")),Integer.parseInt(map.getFirst("sizes")));
    }
    @PostMapping("/showMyUncheck/")
    public JSONObject showMyUncheck(@RequestParam MultiValueMap<String,String> map){
        return checkShowService.showMyUncheck(map.getFirst("author"),Integer.parseInt(map.getFirst("page")),Integer.parseInt(map.getFirst("sizes")));
    }
    @PostMapping("/allCheck/")
    public JSONObject allCheck(@RequestParam MultiValueMap<String,String> map){
        return checkShowService.ShowAll(Integer.parseInt(map.getFirst("page")),Integer.parseInt(map.getFirst("sizes")));
    }
}
